/**
 * @author        Nicolas Bottarini <nicolasbottarini@gmail.com>, 404 <http://www.proyecto404.com>
 * @version       $Rev: 3 $
 * @lastrevision  $Date: 2011-09-12 16:45:37 +0000 (Mon, 12 Sep 2011) $	 
 */
package com.proyecto404.core.mvc {
	import com.proyecto404.core.BaseObject;
	import com.proyecto404.core.Check;
	import com.proyecto404.core.Configuration;
	import com.proyecto404.core.TranslationManager;
	import com.proyecto404.core.collections.Dictionary;
	import com.proyecto404.core.exception.AbstractMethodException;
	
	/**
	 * @abstract
	 */
	public class Action extends BaseObject {
		private var _application:Application;
		
		public function Action(application:Application) {
			Check.argument.isNotNull(application, "application");
			super();
			_application = application;
		}
		
		public function get actionName():String {
			// TODO: Reemplazar solo en el final
			return getClassName().replace("Action", "");
		}
		
		protected function get application():Application {
			return _application;
		}
		
		protected function get navigator():Navigator {
			return application.navigator;
		}

		protected function get library():Library{
			return application.library;
		}

		protected function get configuration():Configuration{
			return application.configuration;
		}
		
		protected function get translations():TranslationManager{
			return application.translations;
		}

		public function sendNotification(name:String, parameters:Object = null):void {
			Check.argument.isNotEmpty(name, "name");
			
			application.dispatchNotification(new Notification(this, name, new Dictionary(parameters)));
		}

		/**
		 * @abstract
		 */
		public function execute(notification:Notification):void { throw new AbstractMethodException(); }
	}
}